﻿<UserControl x:Class="FIFP.DashBoard.Views.OptManagement_New"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"    
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:Presentation="clr-namespace:FIFP.Common.Behaviors.CommonEventArgs;assembly=FIFP.Common"
    xmlns:local="clr-namespace:FIFP.DashBoard.Views"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    DataContext="{Binding OptMngVM,Source={StaticResource ServiceLocator}}"
    d:DesignHeight="1028" d:DesignWidth="1920">

    <Grid x:Name="LayoutRoot" Margin="0,5,0,0">

        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.14*"/>
            <ColumnDefinition Width="Auto" MinWidth="200"/>
            <ColumnDefinition Width="0.15*"/>
            <ColumnDefinition Width="0.26*"/>
            <ColumnDefinition Width="0.34*"/>
        </Grid.ColumnDefinitions>

        
            <Grid Margin="0,25,10,0">
            <local:UCOptimizationFilter x:Name="ucFilter"></local:UCOptimizationFilter>
        </Grid>
        

        <Grid x:Name="treeViewGrid" Grid.Column="1" Margin="0,20,10,0" VerticalAlignment="Top">
            <i:Interaction.Triggers>
                <i:EventTrigger  EventName="Loaded">
                    <i:InvokeCommandAction Command="{Binding TreeviewGridLoaded}" 
        							CommandParameter="{Binding ElementName=treeViewGrid}"  />
                </i:EventTrigger>
            </i:Interaction.Triggers>

            <!--<sdk:TreeView Name="treeView" ItemsSource="{Binding TreeViewUnitList}" Margin="0,10,0,0" VerticalAlignment="Top" Style="{StaticResource TreeViewStyleSMUR}">
                <sdk:TreeView.ItemTemplate>
                    <sdk:HierarchicalDataTemplate ItemsSource="{Binding ChildUnitList}">
                        <StackPanel>
                            <TextBlock Text="{Binding UnitName}" Foreground="{Binding UnitNameTextColor}" IsHitTestVisible="{Binding IsNodeEnabled}"></TextBlock>
                        </StackPanel>
                    </sdk:HierarchicalDataTemplate>
                </sdk:TreeView.ItemTemplate>
                <i:Interaction.Triggers>
                    <i:EventTrigger  EventName="SelectedItemChanged">
                        <i:InvokeCommandAction Command="{Binding TreeviewSelectionChanged}" 
        							CommandParameter="{Binding ElementName=treeView}"  />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </sdk:TreeView>-->
        </Grid>

        <Grid Grid.Column="2" Margin="0,0,10,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>
            <Border BorderThickness="0" Margin="0,0,0,0" Grid.Row="0">
                <TextBlock Text="Opportunities Locations" HorizontalAlignment="Left" Style="{StaticResource ContentHeading}"></TextBlock>
            </Border>

            <Grid x:Name="activitiesLocationGrid" Grid.Row="1" Margin="0">
                <sdk:DataGrid x:Name="linkedLocationGrid" Grid.Row="1" ItemsSource="{Binding FilteredLSDLocations}" AutoGenerateColumns="False" IsReadOnly="True"
                             Style="{StaticResource DataGridStyle}" RowHeaderStyle="{StaticResource DataGridRowHeaderStyle1}" 
                                  ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle}" RowStyle="{StaticResource DataGridRowStyle}" 
                                  CellStyle="{StaticResource DataGridCellStyle}" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Stretch">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="SelectionChanged">
                            <i:InvokeCommandAction Command="{Binding LSDLocationSelectionChanged}" 
        							CommandParameter="{Binding ElementName=linkedLocationGrid}" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTextColumn Header="Type" Width="*" Binding="{Binding UnitType}" MinWidth="75"  />
                        <sdk:DataGridTextColumn Header="Name" Width="*" Binding="{Binding UnitName}" MinWidth="75"  />
                    </sdk:DataGrid.Columns>
                </sdk:DataGrid>
            </Grid>
        </Grid>
        <Grid Grid.Column="3" Margin="0,0,10,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>
            <Border BorderThickness="0" Margin="0,0,50,0" Grid.Row="0">
                <TextBlock Text="Activities" HorizontalAlignment="Left" Style="{StaticResource ContentHeading}"></TextBlock>
            </Border>

            <Grid x:Name="activitiesGrid" Grid.Row="1" Margin="0">
                <sdk:DataGrid x:Name="activitiesOnSelectedUnitGrid" ItemsSource="{Binding FilteredActivityListWithSelectedUnit}" AutoGenerateColumns="False" 
                          Style="{StaticResource DataGridStyle}" RowHeaderStyle="{StaticResource DataGridRowHeaderStyle1}" ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle}" RowStyle="{StaticResource DataGridRowStyle}" CellStyle="{StaticResource DataGridCellStyle}" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" IsReadOnly="True" HorizontalAlignment="Stretch">
                    <i:Interaction.Triggers>
                        <i:EventTrigger  EventName="SelectionChanged">
                            <i:InvokeCommandAction Command="{Binding ActivitySelectChanged}" 
        							CommandParameter="{Binding ElementName=activitiesOnSelectedUnitGrid}"  />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>

                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTextColumn Header="Activity" Width="*"  Binding="{Binding ActivityCode, Mode=OneWay}" MinWidth="90" />
                        <sdk:DataGridTextColumn Header="Start Date" Binding="{Binding Start, Mode=OneWay, StringFormat=dd/MM/yyyy}" Width="110" />
                        <sdk:DataGridTextColumn Header="End Date" Binding="{Binding End,   Mode=OneWay, StringFormat=dd/MM/yyyy}" Width="110" />
                    </sdk:DataGrid.Columns>

                </sdk:DataGrid>
            </Grid>

        </Grid>
        <Grid Grid.Column="5" Margin="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid Margin="0,0,0,0" Grid.Row="0">
                <TextBlock Text="Optimized Activities" HorizontalAlignment="Left" Style="{StaticResource ContentHeading}" />
            </Grid>

            <Grid x:Name="thirdGrid" Grid.Row="1" Margin="0">

                <sdk:DataGrid x:Name="linkedShutdownGrid" ItemsSource="{Binding OptimizedActivityList}" AutoGenerateColumns="False" 
                          Style="{StaticResource DataGridStyle}" ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle}" RowStyle="{StaticResource DataGridRowStyle}" CellStyle="{StaticResource DataGridCellStyle}" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" IsReadOnly="True" HorizontalAlignment="Stretch">

                    <i:Interaction.Triggers>
                        <i:EventTrigger  EventName="SelectionChanged">
                            <i:InvokeCommandAction Command="{Binding ModifiedActivitySelectChanged}" 
        							CommandParameter="{Binding ElementName=linkedShutdownGrid}"  />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTextColumn Header="Activity" Width="*"  Binding="{Binding ActivityCode, Mode=OneWay}" MinWidth="90" />
                        <sdk:DataGridTextColumn Header="Start Date" Binding="{Binding Start, Mode=OneWay, StringFormat=dd/MM/yyyy}"  Width="110"/>
                        <sdk:DataGridTextColumn Header="End Date" Binding="{Binding End,   Mode=OneWay, StringFormat=dd/MM/yyyy}"  Width="110"/>
                        <sdk:DataGridTextColumn Header="Notes" Width="*" Binding="{Binding OptimizedReason, Mode=OneWay}" MinWidth="130" />
                    </sdk:DataGrid.Columns>

                </sdk:DataGrid>

            </Grid>
        </Grid>





        <Path Data="M25.666672,37 L204.34454,37" Margin="0,10" Grid.Row="1" Grid.ColumnSpan="6" Stretch="Fill" StrokeThickness="1" UseLayoutRounding="False" VerticalAlignment="Top" Height="1" Stroke="{StaticResource LineColor}"/>

        <Grid Margin="0" Grid.Row="2" Grid.ColumnSpan="6">
            <local:UCAppointment_New x:Name="shutdownAppointment" />
        </Grid>


    </Grid>
</UserControl>
